export const tableMixins = {
  data() {
    return {
      pagination: {
        total: 0,
        showTotal: total => `共${total}条`,
        showSizeChanger: true,
        pageSize: 10,
        current: 1,
        pageSizeOptions: [10, 20, 50, 100],
        onChange: (page, size) => {
          this.onPaginationChange(page, size);
        },
        onShowSizeChange: (page, size) => {
          this.onPaginationChange(page, size);
        }
      }
    };
  },
  methods: {
    onPaginationChange(page, size) {
      this.query.page = page;
      this.query.size = size;
      this.pagination.current = page;
      this.pagination.pageSize = size;

      this.getList();
    }
  },
  created() {
    this.getList();
  }
};
